#include <iostream>
#include <signal.h>
#include <unistd.h>

void handler(int signo)
{
    std::cout << "get a sig: " << signo << std::endl;
    exit(1);
}

int main()
{
    struct sigaction act,oact;
    act.sa_handler = handler;

    ::sigaction(2,&act,&oact);
    while(true)
    {
        pause();
    }
    return 0;
}
